﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FirstHomeWork.Utility
{
    /// <summary>
    /// 字符串长度特性判断是否超出
    /// </summary>   
    public class CustomStringAttribute : AbstractValidateAttribute
    {
        public int _MinLeng;

        public int _MaxLeng;

        public CustomStringAttribute(int minLength, int maxLength)
        {
            this._MinLeng = minLength;
            this._MaxLeng = maxLength;
        }

        public CustomStringAttribute()
        {
        }

        public override bool Validate(object ovalue)
        {
            return ovalue != null && ovalue.ToString().Length >= _MinLeng && ovalue.ToString().Length <= _MaxLeng;
        }
    }
}
